<!--

     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
     regarding copyright ownership.  The ASF licenses this file
     to you under the Apache License, Version 2.0 (the
     "License"); you may not use this file except in compliance
     with the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing,
     software distributed under the License is distributed on an
     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.

-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- **************************************************************** -->
<!-- *  PLEASE KEEP COMPLICATED EXPRESSIONS OUT OF THESE TEMPLATES, * -->
<!-- *  i.e. only iterate & print data where possible. Thanks, Jez. * -->
<!-- **************************************************************** -->

<html>
<head>
    <!-- Generated by groovydoc (2.4.5) on Mon Sep 12 08:35:20 CEST 2016 -->
    <title>Pump (Groovy Documentation)</title>
    <meta name="date" content="2016-09-12">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="../../../../../groovy.ico" type="image/x-icon" rel="shortcut icon">
    <link href="../../../../../groovy.ico" type="image/x-icon" rel="icon">
    <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

<body class="center">
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
    parent.document.title="Pump (Groovy Documentation)";
}
//-->
</script>
<noscript>
    <div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
    <!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
    <!--   -->
</a>
    <ul class="navList" title="Navigation">
        <li><a href="../../../../../overview-summary.html">Overview</a></li>
        <li><a href="package-summary.html">Package</a></li>
        <li class="navBarCell1Rev">Class</li>
        <li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
        <li><a href="../../../../../index-all.html">Index</a></li>
        <li><a href="../../../../../help-doc.html">Help</a></li>
    </ul>
</div>

<div class="subNav">
    <div>
        <ul class="navList">
            <li><a href="../../../../../index.html?io/vertx/groovy/core/streams/Pump" target="_top">Frames</a></li>
            <li><a href="Pump.html" target="_top">No Frames</a></li>
        </ul>
    </div>
    <div>
        <ul class="subNavList">
            <li>Summary:&nbsp;</li>
            Nested&nbsp;&nbsp;&nbsp;Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li><a href="#constructor_summary">Constructor</a></li>&nbsp;&nbsp;&nbsp;<li><a href="#method_summary">Method</a></li>&nbsp;&nbsp;&nbsp;
        </ul>
        <ul class="subNavList">
            <li>&nbsp;|&nbsp;Detail:&nbsp;</li>
            Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li><a href="#constructor_detail">Constructor</a></li>&nbsp;&nbsp;&nbsp;<li><a href="#method_detail">Method</a></li>&nbsp;&nbsp;&nbsp;
        </ul>
    </div>
    <a name="skip-navbar_top">
        <!--   -->
    </a></div>
<!-- ========= END OF TOP NAVBAR ========= -->

<!-- ======== START OF CLASS DATA ======== -->
<div class="header">

    <div class="subTitle">Package: <strong>io.vertx.groovy.core.streams</strong></div>

    <h2 title="[Groovy] Class Pump" class="title">[Groovy] Class Pump</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><ul class="inheritance"></ul></li><li>io.vertx.groovy.core.streams.Pump
</ul>
<div class="description">
    <ul class="blockList">
        <li class="blockList">



    <p> Pumps data from a <a href='../../../../../io/vertx/groovy/core/streams/ReadStream.html' title='ReadStream'>ReadStream</a> to a <a href='../../../../../io/vertx/groovy/core/streams/WriteStream.html' title='WriteStream'>WriteStream</a> and performs flow control where necessary to
 prevent the write stream buffer from getting overfull.
 <p>
 Instances of this class read items from a <a href='../../../../../io/vertx/groovy/core/streams/ReadStream.html' title='ReadStream'>ReadStream</a> and write them to a <a href='../../../../../io/vertx/groovy/core/streams/WriteStream.html' title='WriteStream'>WriteStream</a>. If data
 can be read faster than it can be written this could result in the write queue of the <a href='../../../../../io/vertx/groovy/core/streams/WriteStream.html' title='WriteStream'>WriteStream</a> growing
 without bound, eventually causing it to exhaust all available RAM.
 <p>
 To prevent this, after each write, instances of this class check whether the write queue of the <a href='../../../../../io/vertx/groovy/core/streams/WriteStream.html' title='WriteStream'>WriteStream</a> is full, and if so, the <a href='../../../../../io/vertx/groovy/core/streams/ReadStream.html' title='ReadStream'>ReadStream</a> is paused, and a <code>drainHandler</code> is set on the
 <a href='../../../../../io/vertx/groovy/core/streams/WriteStream.html' title='WriteStream'>WriteStream</a>.
 <p>
 When the <a href='../../../../../io/vertx/groovy/core/streams/WriteStream.html' title='WriteStream'>WriteStream</a> has processed half of its backlog, the <code>drainHandler</code> will be
 called, which results in the pump resuming the <a href='../../../../../io/vertx/groovy/core/streams/ReadStream.html' title='ReadStream'>ReadStream</a>.
 <p>
 This class can be used to pump from any <a href='../../../../../io/vertx/groovy/core/streams/ReadStream.html' title='ReadStream'>ReadStream</a> to any <a href='../../../../../io/vertx/groovy/core/streams/WriteStream.html' title='WriteStream'>WriteStream</a>,
 e.g. from an <a href='../../../../../io/vertx/groovy/core/http/HttpServerRequest.html' title='HttpServerRequest'>HttpServerRequest</a> to an <a href='../../../../../io/vertx/groovy/core/file/AsyncFile.html' title='AsyncFile'>AsyncFile</a>,
 or from <a href='../../../../../io/vertx/groovy/core/net/NetSocket.html' title='NetSocket'>NetSocket</a> to a <a href='../../../../../io/vertx/groovy/core/http/WebSocket.html' title='WebSocket'>WebSocket</a>.
 <p>
 Please see the documentation for more information.
</p>

          </li>
    </ul>
</div>

<div class="summary">
    <ul class="blockList">
        <li class="blockList">
        <!-- =========== NESTED CLASS SUMMARY =========== -->
        

        <!-- =========== ENUM CONSTANT SUMMARY =========== -->
        
        <!-- =========== FIELD SUMMARY =========== -->
        

        <!-- =========== PROPERTY SUMMARY =========== -->
        

        <!-- =========== ELEMENT SUMMARY =========== -->
        

        
        <!-- ======== CONSTRUCTOR SUMMARY ======== -->
        <ul class="blockList">
                <li class="blockList"><a name="constructor_summary"><!--   --></a>
                    <h3>Constructor Summary</h3>
                    <ul class="blockList">
                    <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructors Summary table">
                        <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
                        <tr>
                            <th class="colFirst" scope="col">Constructor and description</th>
                        </tr>
                        
                        <tr class="altColor">
                            <td class="colFirst">
                                <code><a href="#Pump(java.lang.Object)">Pump</a></strong>
                                (java.lang.Object delegate)</code><br></td>
                        </tr>
                        
                    </table>
                   </ul>
              </li>
        </ul>
        

        
        <!-- ========== METHOD SUMMARY =========== -->
        <ul class="blockList">
            
            <li class="blockList"><a name="method_summary"><!--   --></a>
                    <h3>Methods Summary</h3>
                    <ul class="blockList">
                    <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Methods Summary table">
                        <caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
                        <tr>
                            <th class="colFirst" scope="col">Type</th>
                            <th class="colLast" scope="col">Name and description</th>
                        </tr>
                        
                        <tr class="altColor">
                            <td class="colFirst"><code>java.lang.Object</strong></code></td>
                            <td class="colLast"><code><strong><a href="#getDelegate()">getDelegate</a></strong>()</code><br></td>
                        </tr>
                        
                        <tr class="rowColor">
                            <td class="colFirst"><code>int</strong></code></td>
                            <td class="colLast"><code><strong><a href="#numberPumped()">numberPumped</a></strong>()</code><br>Return the total number of items pumped by this pump.
 </td>
                        </tr>
                        
                        <tr class="altColor">
                            <td class="colFirst"><code>static&nbsp;<a href='../../../../../io/vertx/groovy/core/streams/Pump.html'>Pump</a></strong></code></td>
                            <td class="colLast"><code><strong><a href="#pump(ReadStream<T>, WriteStream<T>)">pump</a></strong>(<a href='../../../../../io/vertx/groovy/core/streams/ReadStream.html' title='ReadStream'>ReadStream</a>&lt;T&gt; rs, <a href='../../../../../io/vertx/groovy/core/streams/WriteStream.html' title='WriteStream'>WriteStream</a>&lt;T&gt; ws)</code><br>Create a new <code>Pump</code> with the given <code>ReadStream</code> and <code>WriteStream</code></td>
                        </tr>
                        
                        <tr class="rowColor">
                            <td class="colFirst"><code>static&nbsp;<a href='../../../../../io/vertx/groovy/core/streams/Pump.html'>Pump</a></strong></code></td>
                            <td class="colLast"><code><strong><a href="#pump(ReadStream<T>, WriteStream<T>, int)">pump</a></strong>(<a href='../../../../../io/vertx/groovy/core/streams/ReadStream.html' title='ReadStream'>ReadStream</a>&lt;T&gt; rs, <a href='../../../../../io/vertx/groovy/core/streams/WriteStream.html' title='WriteStream'>WriteStream</a>&lt;T&gt; ws, int writeQueueMaxSize)</code><br>Create a new <code>Pump</code> with the given <code>ReadStream</code> and <code>WriteStream</code> and
 <code>writeQueueMaxSize</code></td>
                        </tr>
                        
                        <tr class="altColor">
                            <td class="colFirst"><code><a href='../../../../../io/vertx/groovy/core/streams/Pump.html'>Pump</a></strong></code></td>
                            <td class="colLast"><code><strong><a href="#setWriteQueueMaxSize(int)">setWriteQueueMaxSize</a></strong>(int maxSize)</code><br>Set the write queue max size to <code>maxSize</code></td>
                        </tr>
                        
                        <tr class="rowColor">
                            <td class="colFirst"><code><a href='../../../../../io/vertx/groovy/core/streams/Pump.html'>Pump</a></strong></code></td>
                            <td class="colLast"><code><strong><a href="#start()">start</a></strong>()</code><br>Start the Pump. </td>
                        </tr>
                        
                        <tr class="altColor">
                            <td class="colFirst"><code><a href='../../../../../io/vertx/groovy/core/streams/Pump.html'>Pump</a></strong></code></td>
                            <td class="colLast"><code><strong><a href="#stop()">stop</a></strong>()</code><br>Stop the Pump. </td>
                        </tr>
                        
                    </table>
                   </ul>
              </li>
            
            <li class="blockList"><a name="method_summary"><!--   --></a>
                    <h3>Inherited Methods Summary</h3>
                    <ul class="blockList">
                    <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Inherited Methods Summary table">
                        <caption><span>Inherited Methods</span><span class="tabEnd">&nbsp;</span></caption>
                        <tr>
                            <th class="colFirst" scope="col">Methods inherited from class</th>
                            <th class="colLast" scope="col">Name</th>
                        </tr>
                        
                        <tr class="altColor">
                            <td class="colFirst"><code>class java.lang.Object</strong></code></td>
                            <td class="colLast"><code>java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()</code></td>
                        </tr>
                    </table>
                   </ul>
              </li>
                
        </ul>
        
    </li>
    </ul>
</div>

<div class="details">
    <ul class="blockList">
        <li class="blockList">
           

            

            

            

            
            <!-- =========== CONSTRUCTOR DETAIL =========== -->
            <ul class="blockList">
                <li class="blockList"><a name="constructor_detail">
                    <!--   -->
                </a>
                    <h3>Constructor Detail</h3>
                    
                        <a name="Pump(java.lang.Object)"><!-- --></a>
                        <ul class="blockListLast">
                            <li class="blockList">
                                <h4><strong>Pump</strong>(java.lang.Object delegate)</h4>
                                <p></p>
                            </li>
                        </ul>
                    
                </li>
            </ul>
            


            
            <!-- =========== METHOD DETAIL =========== -->
            <ul class="blockList">
                <li class="blockList"><a name="method_detail">
                    <!--   -->
                </a>
                    <h3>Method Detail</h3>
                    
                        <a name="getDelegate()"><!-- --></a>
                        <ul class="blockListLast">
                            <li class="blockList">
                                <h4>java.lang.Object <strong>getDelegate</strong>()</h4>
                                <p></p>
                            </li>
                        </ul>
                    
                        <a name="numberPumped()"><!-- --></a>
                        <ul class="blockListLast">
                            <li class="blockList">
                                <h4>int <strong>numberPumped</strong>()</h4>
                                <p> Return the total number of items pumped by this pump. <DL><DT><B>Returns:</B></DT><DD></DD></DL></p>
                            </li>
                        </ul>
                    
                        <a name="pump(ReadStream<T>, WriteStream<T>)"><!-- --></a>
                        <ul class="blockListLast">
                            <li class="blockList">
                                <h4>static&nbsp;<a href='../../../../../io/vertx/groovy/core/streams/Pump.html'>Pump</a> <strong>pump</strong>(<a href='../../../../../io/vertx/groovy/core/streams/ReadStream.html' title='ReadStream'>ReadStream</a>&lt;T&gt; rs, <a href='../../../../../io/vertx/groovy/core/streams/WriteStream.html' title='WriteStream'>WriteStream</a>&lt;T&gt; ws)</h4>
                                <p> Create a new <code>Pump</code> with the given <code>ReadStream</code> and <code>WriteStream</code>
   <DL><DT><B>Returns:</B></DT><DD>the pump</DD></DL><DL><DT><B>Parameters:</B></DT><DD><code>rs</code> -  the read stream</DD><DD><code>ws</code> -  the write stream</DD></DL></p>
                            </li>
                        </ul>
                    
                        <a name="pump(ReadStream<T>, WriteStream<T>, int)"><!-- --></a>
                        <ul class="blockListLast">
                            <li class="blockList">
                                <h4>static&nbsp;<a href='../../../../../io/vertx/groovy/core/streams/Pump.html'>Pump</a> <strong>pump</strong>(<a href='../../../../../io/vertx/groovy/core/streams/ReadStream.html' title='ReadStream'>ReadStream</a>&lt;T&gt; rs, <a href='../../../../../io/vertx/groovy/core/streams/WriteStream.html' title='WriteStream'>WriteStream</a>&lt;T&gt; ws, int writeQueueMaxSize)</h4>
                                <p> Create a new <code>Pump</code> with the given <code>ReadStream</code> and <code>WriteStream</code> and
 <code>writeQueueMaxSize</code>
   <DL><DT><B>Returns:</B></DT><DD>the pump</DD></DL><DL><DT><B>Parameters:</B></DT><DD><code>rs</code> -  the read stream</DD><DD><code>ws</code> -  the write stream</DD><DD><code>writeQueueMaxSize</code> -  the max size of the write queue</DD></DL></p>
                            </li>
                        </ul>
                    
                        <a name="setWriteQueueMaxSize(int)"><!-- --></a>
                        <ul class="blockListLast">
                            <li class="blockList">
                                <h4><a href='../../../../../io/vertx/groovy/core/streams/Pump.html'>Pump</a> <strong>setWriteQueueMaxSize</strong>(int maxSize)</h4>
                                <p> Set the write queue max size to <code>maxSize</code>
   <DL><DT><B>Returns:</B></DT><DD>a reference to this, so the API can be used fluently</DD></DL><DL><DT><B>Parameters:</B></DT><DD><code>maxSize</code> -  the max size</DD></DL></p>
                            </li>
                        </ul>
                    
                        <a name="start()"><!-- --></a>
                        <ul class="blockListLast">
                            <li class="blockList">
                                <h4><a href='../../../../../io/vertx/groovy/core/streams/Pump.html'>Pump</a> <strong>start</strong>()</h4>
                                <p> Start the Pump. The Pump can be started and stopped multiple times.
   <DL><DT><B>Returns:</B></DT><DD>a reference to this, so the API can be used fluently</DD></DL></p>
                            </li>
                        </ul>
                    
                        <a name="stop()"><!-- --></a>
                        <ul class="blockListLast">
                            <li class="blockList">
                                <h4><a href='../../../../../io/vertx/groovy/core/streams/Pump.html'>Pump</a> <strong>stop</strong>()</h4>
                                <p> Stop the Pump. The Pump can be started and stopped multiple times.
   <DL><DT><B>Returns:</B></DT><DD>a reference to this, so the API can be used fluently</DD></DL></p>
                            </li>
                        </ul>
                    
                </li>
            </ul>
            
        </li>
    </ul>
</div>

<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
    <!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
    <!--   -->
</a>
    <ul class="navList" title="Navigation">
        <li><a href="../../../../../overview-summary.html">Overview</a></li>
        <li><a href="package-summary.html">Package</a></li>
        <li class="navBarCell1Rev">Class</li>
        <li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
        <li><a href="../../../../../index-all.html">Index</a></li>
        <li><a href="../../../../../help-doc.html">Help</a></li>
    </ul>
</div>

<div class="subNav">
    <div>
        <ul class="navList">
            <li><a href="../../../../../index.html?io/vertx/groovy/core/streams/Pump" target="_top">Frames</a></li>
            <li><a href="Pump.html" target="_top">No Frames</a></li>
        </ul>
    </div>
    <div>
        <ul class="subNavList">
            <li>Summary:&nbsp;</li>
            Nested&nbsp;&nbsp;&nbsp;Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li><a href="#constructor_summary">Constructor</a></li>&nbsp;&nbsp;&nbsp;<li><a href="#method_summary">Method</a></li>&nbsp;&nbsp;&nbsp;
        </ul>
        <ul class="subNavList">
            <li>&nbsp;|&nbsp;Detail:&nbsp;</li>
            Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<li><a href="#constructor_detail">Constructor</a></li>&nbsp;&nbsp;&nbsp;<li><a href="#method_detail">Method</a></li>&nbsp;&nbsp;&nbsp;
        </ul>
    </div>
    <p>Groovy Documentation</p>
    <a name="skip-navbar_bottom">
        <!--   -->
    </a>
    </div>
</div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>